package com.jufa_3.controller;

import com.alibaba.fastjson.JSONObject;
import com.jufa_3.common.R;
import com.jufa_3.dto.PayOrderVO;
import com.jufa_3.mapper.PayOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pay-order")
public class PayOrderController {

    @Autowired
    private PayOrderMapper payOrderMapper;

    /**
     * 得到支付记录
     *
     * @param povo
     * @return
     */
    @GetMapping("/getPayRecords")
    public R<Object> getPayRecords(PayOrderVO povo) {
        JSONObject resultJs = new JSONObject();
        resultJs.put("total", payOrderMapper.selectPayOrdersTotal(povo));
        povo.setPageNum((povo.getPageNum() - 1) * povo.getPageSize());
        resultJs.put("records", payOrderMapper.selectPayOrders(povo));
        return R.success(resultJs);
    }

}
